

#ifndef __LED_H
#define __LED_H

#include "gd32f30x.h"
#include <stdbool.h>


#define LED_RCU_GPIOx RCU_GPIOB
#define LED_GPIOx GPIOB
#define LED_GPIO_PIN_x GPIO_PIN_0

#define LED_RCU_TIMERx RCU_TIMER2
#define LED_TIMERx TIMER2
#define LED_TIMER_CH_x TIMER_CH_2

enum{
	LED_SPEED_USER = 4,
	LED_SPEED_TEST = 2,
	LED_SPEED_ADMIN = 0,
};

typedef struct
{
	uint32_t pwmdata;
	uint32_t ledTime;
	uint32_t ledSpeed;
	uint32_t SpeedCount;
} ledConfig_struct;

typedef struct
{
    void (*Set_Speed)(uint32_t Speed);
} ledControl_struct;

typedef struct{
	bool pwmflag;
	ledConfig_struct config;
	ledControl_struct Control;
}Led_Struct;

void vledInit(void);
void vledToggle(bool status);
void vledSetSpeed(uint32_t speed);

#endif   //__LED_H

